import 'package:flutter/material.dart';
import 'package:getwidget/getwidget.dart';
import 'package:meal/constant/sizes.dart';
import 'package:meal/ui/input_text.dart';
import 'package:meal/utils/colors.dart';
import 'package:meal/utils/styles.dart';
import 'package:meal/utils/tools.dart';

///
/// 修改店铺名称
///
class StoreEdit extends StatefulWidget {
  const StoreEdit({Key? key}) : super(key: key);

  @override
  State<StoreEdit> createState() => _StoreEditState();
}

class _StoreEditState extends State<StoreEdit> {
  late TextEditingController textEditingController;

  @override
  void initState() {
    textEditingController = TextEditingController(text: '默林如斯广东粉肠早餐店(凤凰广场店)');
    super.initState();
  }

  @override
  void dispose() {
    textEditingController.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: ToolsUtils.getDefaultBackgroundColor(),
      appBar: ToolsUtils.getDefaultBrnAppBar('店铺名称'),
      body: SingleChildScrollView(
        padding: const EdgeInsets.symmetric(vertical: Sizes.default10, horizontal: Sizes.default15),
        child: Column(
          children: [
            Container(
              padding: const EdgeInsets.all(Sizes.default10),
              decoration: const BoxDecoration(
                  color: Colors.white,
                  borderRadius: BorderRadius.all(Radius.circular(Sizes.default10))),
              child: Column(
                children: [
                  Container(
                    padding: const EdgeInsets.only(bottom: Sizes.default10),
                    alignment: Alignment.centerLeft,
                    child: Text(
                      '中文名称',
                      style: StylesUtils.customTextStyle(
                          fontWeight: FontWeight.bold, color: ColorsUtils.color000),
                    ),
                  ),
                  InputText(
                    searchController: InputTextController()
                      ..isActionShow = false
                      ..isClearShow = true,
                    prefixIcon: Container(),
                    isDense: false,
                    maxLines: 5,
                    maxHeight: 120,
                    outSideColor: Colors.transparent,
                    innerColor: Colors.transparent,
                    innerPadding: EdgeInsets.zero,
                    borderRadius: BorderRadius.zero,
                    hintText: '请输入店铺名称',
                    hintStyle: StylesUtils.customTextStyle(
                        color: ColorsUtils.color999, fontSize: Sizes.default16),
                    controller: textEditingController,
                    textStyle: StylesUtils.customTextStyle(
                        color: ColorsUtils.color333, fontSize: Sizes.default16),
                    onTextCommit: (String name) {},
                  ),
                  Container(
                    padding: const EdgeInsets.only(top: Sizes.default10),
                    alignment: Alignment.centerLeft,
                    child: Text(
                      '可输入5-30个字符的中文名称，支持中英文、数字、横杠、下划线、英文括号，本月还能修改1次。',
                      style: StylesUtils.customTextStyle(
                          fontSize: Sizes.default13, color: ColorsUtils.color999),
                    ),
                  )
                ],
              ),
            ),
            Container(
              height: Sizes.default40,
              margin: const EdgeInsets.only(top: Sizes.default30),
              child: FractionallySizedBox(
                widthFactor: 1,
                child: GFButton(
                    onPressed: () {},
                    text: '确定',
                    textStyle: StylesUtils.customTextStyle(fontSize: Sizes.default16),
                    shape: GFButtonShape.pills,
                    type: GFButtonType.solid,
                    size: GFSize.LARGE,
                    color: ColorsUtils.parseColorFromHexString(ColorsUtils.colorFf6)),
              ),
            )
          ],
        ),
      ),
    );
  }
}
